import { createApp } from 'vue';
import ElementPlus from 'element-plus';
import router from './router';
import App from './App.vue';
import qiankunStart from './qiankun';
import pinia from './store';


import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 样式处理
import './styles/reset.css';
import 'element-plus/dist/index.css';
// 自定义样式
import './styles/index.scss';

const app = createApp(App)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(router)
app.use(pinia as any)
app.use(ElementPlus)
app.mount('#app')

// 确保路由初始化后再注册微应用 启动qiankun
router.isReady().then(() => {
    qiankunStart({
        sandbox: {
            experimentalStyleIsolation: true // Vite 必须开启样式隔离
        }
    });
})
